import { S, U, getRequestId, mapField } from '../../lib/backend'
import Q from 'q'
import axios from 'axios'
import env from '../../config/common'
import {
  UPDATE_INTEL_SEA_FILTER_DATA
} from '../mutation-types'

export default {
  getIntelSeaList ({ dispatch, commit, state, rootState }, info) {
    const URL = env.CRM_API_HOST + '/admin/' + rootState.auth.user.token + '/sites/' + rootState.auth.site_id + '/xiaowu/order/list'
    // const URL = 'http://rap2api.taobao.org/app/mock/2717/POST/admin/[token]/sites/[site_id]/xiaowu%EF%BB%BF/order/list'
    return axios.post(URL + '?' + U(info))
  },
  getIntelDistributeList ({ dispatch, commit, state, rootState }, info) {
    const URL = env.CRM_API_HOST + '/admin/' + rootState.auth.user.token + '/sites/' + rootState.auth.site_id + '/high_seas/distribute/history'
    // const URL = 'http://rap2api.taobao.org/app/mock/2717/GET/admin/%7Btoken%7D/sites/%7Bsite_id%7D/high_seas/distribute/history'
    return axios.get(URL + '?' + U(info))
  },
  saveIntelSeaFilterData ({ state, commit }, queryData) {
    commit(UPDATE_INTEL_SEA_FILTER_DATA, queryData)
  }
}
